public class test_3_2 {
    public static void main(String[] args) {
        int n = 20;
        double sum = 1;
        int i = 1;
        do {
            sum += 1.0 / factorial(i);
            i++;
        } while (i <= n);

        System.out.println(sum);
    }

    public static int factorial(int num) {
        int result = 1;
        for (int i = 1; i <= num; i++) {
            result *= i;
        }
        return result;
    }
}